package com.lindroy.androidplayer.ui.adapter

import androidx.lifecycle.LifecycleOwner
import com.lindroy.androidplayer.base.adapter.BaseListAdapter
import com.lindroy.androidplayer.databinding.CollectedWebsiteItemBinding
import com.lindroy.androidplayer.viewmodels.CollectedWebsiteItemViewModel

/**
 * @author Lin
 * @date 2022/2/21
 * @function
 */
class CollectedWebsiteAdapter(owner: LifecycleOwner) :
    BaseListAdapter<CollectedWebsiteItemViewModel, CollectedWebsiteItemBinding>(owner) {
    override fun CollectedWebsiteItemBinding.onBindViewHolder(
        item: CollectedWebsiteItemViewModel,
        position: Int
    ) {
        vm = item
    }

    override fun artItemsTheSame(
        oldItem: CollectedWebsiteItemViewModel,
        newItem: CollectedWebsiteItemViewModel
    ): Boolean = oldItem.id == newItem.id

    override fun areContentsTheSame(
        oldItem: CollectedWebsiteItemViewModel,
        newItem: CollectedWebsiteItemViewModel
    ): Boolean = oldItem.id == newItem.id
}